package y23.Apr;

import java.util.Scanner;

public class Password {
    public static void main(String[] args) {
        for(int i=0;i<3;i++){
            System.out.println("请输入密码：");
            Scanner scanner = new Scanner(System.in);
            int password = scanner.nextInt();
            if(password == 123456){
                System.out.println("登陆成功");
                break;
            }
            else{
                System.out.println("密码错误，请重新输入，你还有"+(2-i)+"次输入机会");
            }
        }
    }
}
